package main

import (
	"encoding/json"
	"fmt"
)

type Stu struct {
	Name string `json:"name"` //结构体标签
	Age  int    `json:"age"`  //结构体标签
}

func main() {
	stu1 := Stu{"zw", 13}
	jsonStu1, err := json.Marshal(stu1)
	if err != nil {
		fmt.Println("json error ", err)
	}
	fmt.Println("jsonStu1", string(jsonStu1)) // jsonStu1 {"Name":"zw","Age":13}
	// 大写解决 tag  jsonStu1 {"name":"zw","age":13}

}
